<!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.20/angular.js"></script>
            <script type="text/javascript">

                function MyController($rootScope) {
                    this.Name = "jag";
                    this.sal = "4500";
                    console.log($rootScope.variable);
                } 

                MyController.prototype.getAnnualSal = function(){
                        return (this.sal) * 12;
                }
                var app = angular.module("sample", []).run(function($rootScope) {
                                                                $rootScope.variable = 1;
                                                            });
                app.controller("emp", MyController);

            </script>
        </head>
        <body ng-app="sample">
            <div ng-controller="emp as o" >
                Hello {{o.Name}}, your annual salary is {{o.getAnnualSal()}}

            </div>
        </body>
    </html>